*** Imports analysis

use "${data}ImportsReplication.dta", replace

tsset time


newey  lnimports lnrealprice   l.lnugrain l.lnkenrain time, lag(1)
est sto c1
newey  lnimports lnrealprice l.lnrealprice l.lnugrain l.lnkenrain time, lag(1)
est sto c2
newey  lnimports lnrealprice l.lnrealprice l2.lnrealprice  l.lnugrain l.lnkenrain time, lag(2)
est sto c3
newey  lnimports lnrealprice   pand l.lnugrain l.lnkenrain time, lag(1)
est sto c4
newey  lnimports lnrealprice l.lnrealprice pand l.lnugrain l.lnkenrain time, lag(1)
est sto c5
newey  lnimports lnrealprice l.lnrealprice l2.lnrealprice  pand l.lnugrain l.lnkenrain time, lag(2)
est sto c6

esttab c*

esttab c* using  "${tables}\ts_prices_imports.tex", replace ///
se nonotes  style(tex)  b(%12.3f) se(%12.3f)  stats(N, labels(Obs)  fmt(%12.0gc)) ///
	starlevels(* 0.10 ** 0.05 *** 0.01) label mlabels("" "" "" "" "" "") ///
	keep (lnrealprice L.lnrealprice L2.lnrealprice) nonumbers fragment  ///
	 prehead({ \begin{tabular}{lcccccc}    ///
	 \hline \hline ///
	& (1) & (2) & (3) & (4) & (5)  & (6)  \\  ) ///
	prefoot(Period dummies & no & no & no & yes & yes & yes \\  ///
	Newey-West lags & 1 & 1 & 2 & 1 &  1  & 2 \\)   ///
	  postfoot(\hline \hline \end{tabular} } \begin{tablenotes}[para,flushleft] \footnotesize{The dependent variable in all estimations is the natural log of the total bags of charcoal reported to have entered the country at the Busia border crossing in each month.  Regressions use data of imports and real charcoal prices from January 2018 to December of 2021 and include the natural log of rainfall in Kenya and in Uganda for the previous month, as well as a time trend. Columns (4), (5) and (6) include dummy variables indicating the post ban period (February 2018 to February 2020) and the pandemic period (March 2020 to December 2021). All regressions use Newey-West standard errors, and the maximum lag to be considered in the autocorrelation structure in each regression is shown under the estimates.  * p $<$.10, ** p$<$ .05, *** p$<$.01.} \end{tablenotes} )
estimates clear

** Let's do Engel-Granger now!

egranger   lnimports lnrealprice  l.lnugrain l.lnkenrain time, reg lags(1)
est sto c1
egranger   lnimports lnrealprice l.lnrealprice l.lnugrain l.lnkenrain time, reg lags(1)
est sto c2
egranger   lnimports lnrealprice l.lnrealprice l2.lnrealprice  l.lnugrain l.lnkenrain time, reg lags(2)
est sto c3
egranger   lnimports lnrealprice l.lnrealprice  pand l.lnugrain l.lnkenrain time, reg lags(1)
est sto c4
egranger   lnimports lnrealprice l.lnrealprice pand l.lnugrain l.lnkenrain time, reg lags(1)
est sto c5
egranger   lnimports lnrealprice l.lnrealprice l2.lnrealprice  pand l.lnugrain l.lnkenrain time, reg lags(2)
est sto c6

esttab c*

esttab c* using  "${tables}\ts_cointegration.tex", replace ///
se nonotes  style(tex)  b(%12.3f) se(%12.3f)  stats(N, labels(Obs)  fmt(%12.0gc)) ///
	starlevels(* 0.10 ** 0.05 *** 0.01) label mlabels("" "" "" "" "" "") ///
	keep (L._egresid) nonumbers fragment  ///
	 prehead({ \begin{tabular}{lcccccc}    ///
	 \hline \hline ///
	& (1) & (2) & (3) & (4) & (5)  & (6)  \\  ) ///
	prefoot(Period dummies & no & no & no & yes & yes & yes \\  ///
	Engel-Granger lags & 1 & 1 & 2 & 1 &  1  & 2    ///
	  postfoot(\hline \hline \end{tabular} } \begin{tablenotes}[para,flushleft] \footnotesize{ Regressions use data of imports and real charcoal prices January 2018 to December of 2021. Columns (4), (5) and (6) include dummy variables indicating the post ban period (February 2018 to February 2020) and the pandemic period (March 2020 to December 2021). The number of lags used in the Engel-Granger cointegration test is displayed in the last row of the table.  * p $<$.10, ** p$<$ .05, *** p$<$.01.} \end{tablenotes} )
estimates clear
